package com.ama.service.impl;

import com.ama.dao.EmployeeDao;
import com.ama.pojo.Company;
import com.ama.pojo.Employee;
import com.ama.pojo.Person;
import com.ama.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeServiceImp implements EmployeeService {
	@Autowired
	EmployeeDao employeeDao;
	@Override
	public void insert(long p_id, long c_id) {
		employeeDao.save(p_id, c_id);
	}
	
	@Override
	public Employee query(long p_id, long c_id) {
		Employee employee = employeeDao.findEmployeeByIds(p_id, c_id);
		return employee;
	}

	@Override
	public List<Person> candidateQuery(long c_id) {
		List<Person> persons = employeeDao.findPersonsByCompanyId(c_id);
		return persons;
	}

	@Override
	public void update(long isAgreed,long id) {
		employeeDao.updateisAgreed(isAgreed,id);
	}

	@Override
	public List<Company> companyQuery(long p_id) {

		List<Company> companys = employeeDao.findCompanysByPersonId(p_id);
		return companys;
	}


}
